//
//  TBCStationTableViewCell.m
//  待定
//
//  Created by EricXie on 15/11/6.
//  Copyright © 2015年 BoyaLee. All rights reserved.
//

#import "TBCStationTableViewCell.h"

@implementation TBCStationTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createSubViews];
    }
    
    return self;
}

- (void)createSubViews
{
    self.headerImageV = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH * 0.03, HEIGHT * 0.015, HEIGHT * 0.12, HEIGHT * 0.12)];
    _headerImageV.backgroundColor = [UIColor lightGrayColor];
    _headerImageV.layer.masksToBounds = YES;
    _headerImageV.layer.cornerRadius = 15;
    [self addSubview:_headerImageV];
    
    self.titleLabel = [[BaseLabel alloc] initWithFrame:CGRectMake(_headerImageV.frame.size.width + WIDTH * 0.06, self.headerImageV.frame.origin.y, WIDTH * 0.5, HEIGHT * 0.03)];
    _titleLabel.font = [UIFont systemFontOfSize:17 * SIZE];
    [self addSubview:_titleLabel];
    
    self.listenLabel = [[BaseLabel alloc] initWithFrame:CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + HEIGHT * 0.05, _titleLabel.frame.size.width, _titleLabel.frame.size.height)];
    _listenLabel.textColor = [UIColor lightGrayColor];
    _listenLabel.font = [UIFont systemFontOfSize:15 * SIZE];
    [self addSubview:_listenLabel];
    
    self.playImageV = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH * 0.85, _headerImageV.frame.size.height / 2 - HEIGHT * 0.01, WIDTH * 0.08, WIDTH * 0.08)];
    _playImageV.backgroundColor = [UIColor lightGrayColor];
    _playImageV.image = [UIImage imageNamed:@"play"];
    _playImageV.layer.masksToBounds = YES;
    _playImageV.layer.cornerRadius = WIDTH * 0.04;
    [self addSubview:_playImageV];
    
    self.isNewImageV = [[UIImageView alloc] initWithFrame:CGRectMake(_headerImageV.frame.origin.x, _headerImageV.frame.origin.y, HEIGHT * 0.06, HEIGHT * 0.06)];
    _isNewImageV.image = [UIImage imageNamed:@"iconfont-tubiao103"];
    [self addSubview:_isNewImageV];
}

- (void)setRadio:(TBCRadioListModel *)radio
{
    [_headerImageV sd_setImageWithURL:[NSURL URLWithString:radio.coverimg]];
    _titleLabel.text = radio.title;
    _listenLabel.text = [NSString stringWithFormat:@"收听:%@", radio.musicVisit];
    if (!radio.isnew) {
        _isNewImageV.hidden = YES;
    } else {
        _isNewImageV.hidden = NO;
    }
}

@end
